#ifndef CPP_RECT_PROGRESS_BAR_H
#define CPP_RECT_PROGRESS_BAR_H

#include <Bitmap.h>
#include <widget/ProgressBar.h>

//@brief 矩形进度条控件
//@author cvte
//@description 可实现矩形进度条，支持多个方向形态
class RectProgressBar : public ProgressBar {
   public:
    typedef enum {
        RECT_TYPE_LEFT_RIGHT,          //从左到右矩形进度
        RECT_TYPE_DOWN_UP,             //从下到上矩形进度
        RECT_TYPE_DOWN_UP_LEFT_RIGHT,  //从左下、左上、右上、右下的矩形进度
        RECT_TYPE_COUNT
    } RECT_TYPE;

    RectProgressBar();
    ~RectProgressBar();

    void setRectType(RECT_TYPE rectType);

   protected:
    void onDraw(Canvas& canvas);
    int pointToProgress(int x, int y);

   private:
    int mRectType = RECT_TYPE_LEFT_RIGHT;
};

#endif